home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / ca29_3.zip / FINDNAME.CMD < prev    next >
OS/2 REXX Batch file  |  1989-07-14  |  2KB  |  60 lines

  1. ; ----- Findname: Look up a word in the dialing directory
  2. ;    If no directory entry matches, look for a script
  3. ;    with the given name.
  4. ;
  5. ;    R.McG; 7/89, Chicago
  6. ; ----------------------------------------------------------------
  7. ;    Ask for a word
  8. ;
  9.    WOPEN 10 10 13 70 (blue red) ESCape
  10.    ATSAY 10 12 (blue yellow) " Find Name "
  11.    ATSAY 11 12 (blue yellow) "Enter the word to be searched: "
  12.    ATGET 12 12 (blue white) 26 S0 ; Read word
  13.    WCLOSE
  14.  
  15.    IF NULL S0            ; If file not open
  16.       SOUND 55,1000        ; Bronx cheer
  17.       EXIT            ; Stop here
  18.       ENDIF
  19. ;
  20. ;    Look for the word in the dialing directory
  21. ;
  22.    LEGEND "FindName: Searching dialing directory"
  23.    FOR N0 = 1,100
  24.        DIRECT S1 N0        ; Entry name
  25.        IF FIND S1 S0        ; If we find word in name
  26.       LEGEND "FindName: Dialing " * S1
  27.       DIAL N0        ; Dial number
  28.       IF SUCCESS        ; Entry number
  29.          DSCRIPT S1 N0    ; Look for a linked script
  30.          IF NOT NULL S1    ; Script name when used
  31.         SET LINKED ON    ; Fake entry from dial command
  32.         EXECUTE S1    ; Link to script
  33.         ENDIF
  34.          ENDIF
  35.        EXIT         ; Exit whether dial succeed or failed
  36.        ENDIF
  37.        ENDFOR
  38. ;
  39. ;    Look for an executable script file of that name
  40. ;
  41.    LEGEND "FindName: Searching for script named "*S0
  42.    IF ISSCFile S0        ; If script file of that name exists
  43.       LEGEND ""                 ; Clear legend line
  44.       EXECUTE S0        ; Execute it
  45.       ENDIF
  46. ;
  47. ;    Failed
  48. ;
  49.    CURSOR N0,N1
  50.    ATSAY N0,N1 (DEFAULT) "Word does not exist"
  51.    MESSAGE "^M^J"               ; Scroll down
  52.    SOUND 55,500
  53.    EXIT
  54. ;
  55. ;    Escape - simply no-op
  56. ;
  57. Escape:
  58.    S0 = ""                      ; Make null return
  59.    RETURN
  60.